package com.sgj.gulimall.cart.config;

import com.sgj.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: Guoji Shen
 * @Date: 2021/9/13 10:31
 */
@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 所有请求添加拦截器
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}